<!DOCTYPE html>
<html>
<head>
<title>待还记录</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../include/resources.html">
<script type="text/javascript">
    //$.fn.iframeWidthResize(640);//页面最小宽度设置
    var dataGrid;
    var winWidth =  800;
    var winHeight = 280;
    $(function() {
        dataGrid = $('#dataGrid').datagrid({
            url : 'repaymentList.html',
            fit : true,
            fitColumns : true,
            border : false,
            pagination : true,
            idField : 'id',
            pageSize : pageSize,
            pageNums :1,
            pageList : pageList,
            sortName : 'id',
            sortOrder : 'asc',
            checkOnSelect : false,
            selectOnCheck : false,
            nowrap : false,
			singleSelect:true,
            columns : [ [
			  { field: 'id', title: '编号', width: 50, fixed: true,sortable:false },              
              { field: 'userName', title: '用户名', width: 80, sortable:false },
              { field: 'realName', title: '借款人姓名', width: 80, sortable:false },
              { field: 'borrowName', title: '标名', width: 210, sortable:false },
              { field: 'period', title: '期数', width: 40,fixed:true, sortable:false, 
            	  	formatter: function(value,row,index){
  						return row.period+1;
				  	}
              },
              { field: 'repaymentTime', title: '预计还款时间', width: 150, sortable:false,formatter: function(value,row,index){
            	  return getLocalTime(value,4);
  				  }  
              },
              { field: 'repaymentYesTime', title: '实际还款时间', width: 150, sortable:false,formatter: function(value,row,index){
            	  if(value!=null){	
            		  return getLocalTime(value,4);
            	  }else{
            		  return "-";
            	  }
				 }  
              },
              { field: 'repaymentAccount', title: '预还金额(元)', width: 80, sortable:false,formatter: function(value,row,index){
            	  return value;
              }},
              { field: 'repaymentYesAccount', title: '已还金额(元)', width: 80, sortable:false,formatter: function(value,row,index){
            	  return value;
              }},
              { field: 'capital', title: '本金(元)', width: 80, sortable:false,formatter: function(value,row,index){
            	  return value;
              }},
              { field: 'interest', title: '利息(元)', width: 80, sortable:false,formatter: function(value,row,index){
            	  return value;
              }},
             /*  { field: 'forfeit', title: '滞纳金', width: 80, sortable:false,formatter: function(value,row,index){
            	  return value+"元";
              }},
              { field: 'reminderFee', title: '催收费', width: 80, sortable:false,formatter: function(value,row,index){
            	  return value+"元";
              }}, */
              { field: 'statusString', title: '状态', width: 60,fixed: true, sortable:false}
              ] ]
        });
    });
    
    function exportExcel(){
		var url = '/modules/loan/repayment/exportExcelRepayment.html?type=export';
		var userName = $("#userName").val();
		var realName = $("#realName").val();
		var status = $("#status").val();
		var startTime = $("#startTime").val();
		var endTime = $("#endTime").val();
		var sou = "&userName=" + userName + "&realName=" + realName + "&status=" + status + "&startTime=" + startTime + "&endTime=" + endTime;
		window.location.href = url + sou;
	}
</script>
</head>
<body style="padding:0 20px;" >
    <div class="easyui-layout" data-options="fit : true,border : false">
        <div data-options="region:'north',border:false,collapsible:false" id="searchBox">
        	<div class="sLeft">
	            <form id="searchForm">
	            	<input type="text"  name="searchName" id="searchName" class="sInput" placeholder="输入借款人姓名/用户名/标名进行搜索" autocomplete="off" onkeydown="if(event.keyCode == 13){ $.fn.dataGridOptions.searchFun('#searchForm');return false;}"/><a href="javascript:;" title="查询" class="sBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">查询</a><a href="javascript:;" class="advBtn" title="条件查询">条件查询 <i class="iconfont">&#xe638;</i></a>
	           		<a href="javascript:void(0);" class="reloadIcon" onclick="dataGrid.datagrid('reload');" title="刷新" ><i class="iconfont">&#xe603;</i></a>
                    <font style="color:red;">              *贷款余额 ：${remainderAccount} </font>
	            </form>
            </div>
            <div class="sRight">
            	<a href="javascript:void(0);" onclick="exportExcel();">导出Excel</a>
            </div>
            <form id="showAdw">
		        <ul class="showAdw" style="display:none;">
		        	<a href="javascript:void(0);"><i class="iconfont closeWin">&#xe628;</i></a>
		       		<li><span>借款人姓名</span><input type="text" name="realName" autocomplete="off" id="realName"/></li>
		       		<li><span>用户名</span><input type="text" name="userName" autocomplete="off" id="userName"/></li>
		       		<li><span>状态</span><select name="status" class="status" id="status">
		                  <option value="99">全部</option>
		                  <option value="0" selected="selected">未还款</option>
		                  <option value="1">已还款</option>
		                  <option value="4">代偿处理中</option>
		                </select></li>
		       		<li><span>预计还款时间</span><input type="text" name="startTime" id="startTime" value="<#if startTime??>${startTime}</#if>" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'endTime\')}',readOnly:true})" class="searchTime"/>&nbsp;-&nbsp;<input type="text" name="endTime" id="endTime" value="<#if endTime??>${endTime}</#if>" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\')}',readOnly:true})" class="searchTime"/></li>
		       		<li><span>&nbsp;</span><a href="javascript:void(0);" class="searchBtn sureBtn" onclick="$.fn.dataGridOptions.searchFun('#showAdw');">确定</a><a href="javascript:void(0);" class="searchBtn" onclick="$.fn.dataGridOptions.cleanFun('#searchForm');">重置</a></li>
		        </ul>
	        </form>
        </div>
        <div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
            <table id="dataGrid"></table>
        </div>
    </div>
</body>
</html>
<script src="${theme_dir}/js/search.js"></script>